Empresas
Empregos
  • Sobre nós
  • Soluções
    • Publicação de vagas
      Publique sua vaga e receba candidatos qualificados em 48h.
    • Avaliações de candidatos
      Mais de 500 testes técnicos e psicológicos, mais anti-fraude.
    • Headhunting
      Busca executiva personalizada do início ao fim.
    • Folha de Pagamento + EOR
      Dispersão de folha e EOR em mais de 15 países da LATAM.
  • Preços
  • Empregos

0

426
Visualizações
Discord.js error "TypeError: channel.updateOverwrite is not a function"

When I'm trying to change the channel permissions to lock users from sending messages, this error pops up no matter what I do.

TypeError: channel.updateOverwrite is not a function

Is there anything wrong?

module.exports =
{
    async execute(message, args)
    {
            const role = message.guild.roles.cache.find(r => r.name === '@everyone')

            let channel = message.mentions.channels.first() || args[0]
            if(!channel) channel = message.channel

            if(channel.permissionsFor(message.guild.id).has('SEND_MESSAGES') === false) return message.channel.send(`${channel} is already locked.`)

            await channel.updateOverwrite(message.guild.id, { SEND_MESSAGES: false }).catch(() => {}) // Line in which the error happens
            await channel.updateOverwrite(role, { SEND_MESSAGES: false} ).catch(() => {})
    }
}
about 4 years ago · Juan Pablo Isaza
1 Respostas
Responde à pergunta

0

It seems you're using discord.js v13 but using some old code. In v13 the channel#updateOverwrite() method is removed and while in previous version channel#permissionOverwrites was a collection of overwrites, in v13 it's a PermissionOverwriteManager. It means, you should use its .edit() method to update overwrites:

await channel
  .permissionOverwrites.edit(message.guild.id, { SEND_MESSAGES: false })
await channel
  .permissionOverwrites.edit(role, { SEND_MESSAGES: false })
about 4 years ago · Juan Pablo Isaza Relatório
Responde à pergunta
Encontrar trabalhos remotos

Descubra a nova forma de encontrar um emprego!

melhores empregos
Principais categorias de trabalho
Empresas
Postar vaga Preços Comercial
Jurídico
Termos e Condições Política de privacidade
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomende algumas ofertas para mim
Preciso de ajuda